<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" class="active"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">商品信息</a></li>
        <li role="presentation"><a href="#spec" aria-controls="spec" role="tab" data-toggle="tab">商品规格</a></li>
    </ul>
    <div class="tab-content">
        <div role="tabpanel" class="tab-pane active" id="info">
            <div class="form-group"></div>

            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Area')}:</label>
                <div class="col-xs-12 col-sm-8">
                    {:build_radios('row[area]', $areaList, $row['area']??1)}
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('活动商品')}:</label>
                <div class="col-xs-12 col-sm-8">
                    {:build_radios('row[is_activity]', $activityList, $row['is_activity']??0)}
                    (活动商品不参与返利和代理销量统计,不参与拼团)
                </div>
            </div>

            <!-- <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-category_id" data-rule="required" data-source="goods_category/index" class="form-control selectpage" name="row[category_id]" type="text" value="{$row.category_id?:''}">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Brand_id')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-brand_id" data-rule="required" data-source="brand/index" class="form-control selectpage" name="row[brand_id]" type="text" value="{$row.brand_id?:''}">
                </div>
            </div> -->
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name?:''}">
                </div>
            </div>
            <!-- <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Market_price')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-market_price" data-rule="required" class="form-control" step="0.01" name="row[market_price]" type="number" value="{$row.market_price?:0}">
                </div>
            </div> -->
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-price" data-rule="required" class="form-control" step="0.01" name="row[price]" type="number" value="{$row.price?:0}">
                </div>
            </div>
            <!-- <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Cost_price')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-cost_price" class="form-control" step="0.01" name="row[cost_price]" type="number" value="{$row.cost_price?:0}">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Commission')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-commission" class="form-control" step="0.01" name="row[commission]" type="number" value="{$row.commission?:0}">
                </div>
            </div> -->
 <!--            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Number_store')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-number_store" data-rule="required" class="form-control" name="row[number_store]" type="number" value="{$row.number_store?:10}">
                </div>
            </div> -->
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Group_number')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-group_number" data-rule="required" class="form-control" step="1" name="row[group_number]" type="number" value="{$row.group_number?:3}">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Group_hour')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-group_hour" data-rule="required" class="form-control" step="1" name="row[group_hour]" type="number" value="{$row.group_hour?:24}">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Min_number')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-min_number" data-rule="required" class="form-control" step="1" name="row[min_number]" type="number" value="{$row.min_number?:0}">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Buy_level')}:</label>
                <div class="col-xs-12 col-sm-8">
	                {:build_checkboxs('row[buy_level][]', $levelList, $row['buy_level']??-1)}
                </div>
            </div>
    
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('发货方式')}:</label>
                <div class="col-xs-12 col-sm-8">
                    {:build_select('row[shipping_type]', $shippingType, $row['shipping_type']??0)}
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('是否发展中心发货')}:</label>
                <div class="col-xs-12 col-sm-8">
                    {:build_select('row[center_shipping]', $activityList, $row['center_shipping']??0)}
                </div>
            </div>
            
        <!--     <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Group_limit')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-group_limit" class="form-control" step="1" placeholder="0为不限制" name="row[group_limit]" type="number" value="{$row.group_limit?:''}">
                </div>
            </div> -->
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Group_rebate')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-group_rebate" class="form-control" step="1" placeholder="没有规格时拼团成功的红包金额(深圳不生效)" name="row[group_rebate]" type="number" value="{$row.group_rebate?:''}">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <div class="input-group">
                        <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="{$row.image?:''}">
                        <div class="input-group-addon no-border no-padding">
                            <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                            <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                        </div>
                        <span class="msg-box n-right" for="c-image"></span>
                    </div>
                    <ul class="row list-inline plupload-preview" id="p-image"></ul>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <div class="input-group">
                        <input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images?:''}">
                        <div class="input-group-addon no-border no-padding">
                            <span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                            <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                        </div>
                        <span class="msg-box n-right" for="c-images"></span>
                    </div>
                    <ul class="row list-inline plupload-preview" id="p-images"></ul>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-sort" data-rule="required" class="form-control" name="row[sort]" type="number" value="{$row.sort?:50}">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
                <div class="col-xs-12 col-sm-8">
                    {:build_radios('row[status]', $statusList, $row['status']??1)}
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content?:''}</textarea>
                </div>
            </div>
        </div>
        <div role="tabpanel" class="tab-pane" id="spec">
            <table class="table table-bordered">
                <tr class="alert-success">
                    <th>图片</th>
                    <th>规格名称</th>
                    <!-- <th>库存</th> -->
                    <th>价格</th>
                    <th>拼团红包</th>
                    <th>操作</th>
                </tr>
                <tbody>

                    <tr v-for="(item, index) in specs">
                       
                        <td>
                            <div class="input-group">
                                <input :id="'c-specimage-'+index" data-rule="required" class="form-control" size="50" :name="'row[spec]['+index+'][image]'" type="text" v-model="item.image">
                                <div class="input-group-addon no-border no-padding">
                                    <span><button type="button" :id="'plupload-image'+index" class="btn btn-danger plupload" :data-input-id="'c-specimage-'+index" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp"  data-upload-success="upload_success" data-multiple="false" :data-preview-id="'p-specimage-'+index"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                                    <span><button type="button" :id="'fachoose-image'+index" class="btn btn-primary fachoose" :data-input-id="'c-specimage-'+index" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                                </div>
                                <span class="msg-box n-right" :for="'c-specimage-'+index"></span>
                            </div>
                            <ul class="row list-inline plupload-preview" :id="'p-specimage-'+index"></ul>
                        </td>
                         <td>
                            <input :id="'c-name-'+index" data-rule="required" class="form-control" :name="'row[spec]['+index+'][name]'" type="text" v-model="item.name">
                        </td>
                    <!--     <td>
                            <input id="c-store_count" data-rule="required" class="form-control" :name="'row[spec]['+index+'][store_count]'"  type="number" v-model="item.store_count">
                        </td> -->
                        <td>
                            <input :id="'c-price-'+index"  class="form-control" :name="'row[spec]['+index+'][price]'"  type="number" v-model="item.price">
                        </td>
                        <td>
                            <input :id="'c-group_rebate-'+index" data-rule="required" class="form-control" :name="'row[spec]['+index+'][group_rebate]'"  type="number" v-model="item.group_rebate">
                        </td>
                        
                        <input type="hidden" :name="'row[spec]['+index+'][id]'" v-model="item.id">
                        <td>
                            <button class="btn btn-danger btn-sm" @click="del_spec(item, index)">删除</button>
                        </td>
                    </tr>
                </tbody>
            </table>
            <button class="btn btn-info add-spec" @click="add_spec()" type="button">加一列</button>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script src="https://unpkg.com/vue@2.5.16/dist/vue.js"></script>
